﻿using System.Collections.Generic;

namespace AccelerateSensor.Service.DbProxy.SQLite.Bll
{
    internal class Node
    {
        private readonly Dal.Node _dal = new Dal.Node();

        /// <summary>
        /// 添加节点
        /// </summary>
        /// <param name="model">节点对象</param>
        /// <returns>Rid</returns>
        public int Add(Models.Node model)
        {
            return _dal.Insert(model);
        }

        /// <summary>
        /// 批量添加节点
        /// </summary>
        /// <param name="models">节点对象集合</param>
        /// <returns>true成功，false失败</returns>
        public bool Add(List<Models.Node> models)
        {
            return _dal.Insert(models);
        }

        /// <summary>
        /// 更新节点
        /// </summary>
        /// <param name="model">节点对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Update(Models.Node model)
        {
            return _dal.Update(model);
        }

        /// <summary>
        /// 通过编号更新节点
        /// </summary>
        /// <param name="model">节点对象</param>
        /// <returns>true成功，false失败</returns>
        public bool UpdateByUuid(Models.Node model)
        {
            return _dal.UpdateByUuid(model);
        }

        /// <summary>
        /// 删除节点
        /// </summary>
        /// <param name="model">节点对象</param>
        /// <returns>true成功，false失败</returns>
        public bool Delete(Models.Node model)
        {
            return _dal.Delete(model);
        }

        /// <summary>
        /// 查询节点
        /// </summary>
        /// <param name="rid">节点id</param>
        /// <returns>节点对象</returns>
        public Models.Node GetModel(int rid)
        {
            return _dal.GetModel(rid);
        }

        /// <summary>
        /// 查询所有节点
        /// </summary>
        /// <returns>节点对象集合</returns>
        public List<Models.Node> GetAllModels()
        {
            return _dal.GetAllModels();
        }
    }
}
